<?php
namespace App\Rules\Admin;

class SaveRoleRule extends \App\Rules\FormRequest
{
    /**
     * 访问权限验证
     * @return bool
     */
    public function authorize(){
        return true;
    }

    /**
     * 验证规则
     * @return array
     */
    public function rules(){
        return [
            'name' => 'required|max:255',
            'status' => 'required|in:0,1',
        ];
    }

    /**
     * 验证消息
     * @return array
     */
    public function messages(){
        return [
            'name.required' => '请输入角色名称',
            'name.max' => '角色名称已超过255个字符',
            'status.required' => '请选择角色状态',
            'status.in' => '角色状态出错',
        ];
    }
}